From ec8627b0eff55db1a8bdfe7bb327c31c6ca3dad7 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Mon, 4 Jul 2022 18:12:56 +0100
Subject: [PATCH] media: i2c: ov9281: Change exposure default value
 with mode choice

When the exposure range is updated due to changing VBLANK, adopt
the mode default value, not the current default.

Should the specific default value be outside of the min/max range
defined, then the whole update is rejected, which can leave an
invalid exposure range active.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
 drivers/media/i2c/ov9281.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/media/i2c/ov9281.c
+++ b/drivers/media/i2c/ov9281.c
@@ -976,7 +976,7 @@ static int ov9281_set_ctrl(struct v4l2_c
 		__v4l2_ctrl_modify_range(ov9281->exposure,
 					 ov9281->exposure->minimum, max,
 					 ov9281->exposure->step,
-					 ov9281->exposure->default_value);
+					 ov9281->cur_mode->vts_def);
 		break;
 	}
 
